/*****************************************************************************/
/**
 *  @file   DataSet.h
 *  @author Naohisa Sakamoto
 */
/*----------------------------------------------------------------------------
 *
 *  Copyright (c) Visualization Laboratory, Kyoto University.
 *  All rights reserved.
 *  See http://www.viz.media.kyoto-u.ac.jp/kvs/copyright/ for details.
 *
 *  $Id$
 */
/*****************************************************************************/
#pragma once
#include <string>
#include <kvs/SharedPointer>
#include <kvs/StructuredVolumeObject>
#include <kvs/PointObject>
#include <kvs/TransferFunction>
#include <kvs/Vector3>


class DataSet
{
public:

    struct Range { kvs::Vec3 min; kvs::Vec3 max; };
    struct Bounds { std::vector<Range> ranges; };

public:

    typedef kvs::SharedPointer<kvs::StructuredVolumeObject> Volume;
    typedef kvs::SharedPointer<kvs::PointObject> Particles;

private:

    std::string m_filename;
    Volume m_volume;
    Particles m_particles;
    Bounds m_bounds;

public:

    DataSet( const std::string& filename );

    const std::string& filename() const { return m_filename; }
    const Volume& volume() const { return m_volume; }
    const Particles& particles() const { return m_particles; }
    kvs::Vector3ui volumeResolution() const { return m_volume->resolution(); }
    std::string volumeDataType() const { return m_volume->values().typeInfo()->typeName(); }
    size_t volumeDataSize() const { return m_volume->values().byteSize(); }
    size_t numberOfParticles() const { return m_particles->numberOfVertices(); }
    size_t particleDataSize() const { return numberOfParticles() * 27; }
    const Bounds& bounds() const { return m_bounds; }

    void loadVolume();
    void generateParticles( const size_t repeats, const kvs::TransferFunction& tfunc );
};
